/*
 * cStat.cpp
 *
 *  Created on: 23-11-2011
 *      Author: pawel
 */
#include"cStat.h"
#include "math.h"
#include "../heuristics/fastaAlgParam.h"


statResult computeStats(diagonal *diagPtr, size_t length)
{
	statResult result;
	result.mean=0.0;
	result.stdDev=0.0;
	for(size_t i =0 ;i<length;i++){
		result.mean += (double)(diagPtr[i].count);
	}
	result.mean/= (double)(length);
	for(size_t i=0;i<length;i++){
		result.stdDev +=(double) (diagPtr[i].count - result.mean)*(diagPtr[i].count - result.mean);
	}
	if(length >1){
		result.stdDev/=(double)(length -1);
	}
	result.stdDev = sqrt(result.stdDev);
	return result;
}

